package cn.first;

import java.io.IOException;

import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class LoginServlet2 extends GenericServlet{

	private static final long serialVersionUID = 1L;

	@Override
	public void service(ServletRequest req, ServletResponse resp) throws ServletException, IOException {
		
		resp.getWriter().println("It is the 2th login servel ...");
		
		String user=req.getParameter("username");
		String passwd=req.getParameter("password");
		
		if(user.equals(getServletContext().getInitParameter("username")) && passwd.equals(getServletContext().getInitParameter("password"))) {
			resp.getWriter().println("Login success!");
		}else {
			resp.getWriter().println("Login fail!");
		}
		
	}
	

}
